package com.njust.bean;

import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class IOCTest4 {

    private ConfigurableApplicationContext ioc;

    @Before
    public void tearUp(){
        ioc = new ClassPathXmlApplicationContext("config/ioc4.xml");
    }

    /**
     * 实验13：基于XML的自动装配（自定义类型自动赋值）
     *         javaBean（基本类型）
     *                 （自定以类型的属性是一个对象，这个对象在容器中可能存在）
     */
    @Test
    public void test13(){
        System.out.println("=========实验十三==========");
        XmlAutowire xmlAutowire01 = ioc.getBean( "xmlAutowire01", XmlAutowire.class);
        System.out.println(xmlAutowire01);
        XmlAutowire xmlAutowire02 = ioc.getBean( "xmlAutowire02", XmlAutowire.class);
        System.out.println(xmlAutowire02);
        XmlAutowire xmlAutowire03 = ioc.getBean( "xmlAutowire03", XmlAutowire.class);
        System.out.println(xmlAutowire03);
        XmlAutowire xmlAutowire04 = ioc.getBean( "xmlAutowire04", XmlAutowire.class);
        System.out.println(xmlAutowire04);
        System.out.println("========结束==========");
    }
}
